<template>
  <div>
    <div class="qup-title-box"><span class="border" /><span>各节点记录</span></div>
    <el-table
      :data="tableData"
      border
      max-height="300"
      :header-cell-style="{background:'#F6F6F6', borderRight:'1px solid #EBEEF5'}"
      style="width: 100%"
    >
      <el-table-column type="index" width="55" />
      <el-table-column prop="step" label="操作步骤">
        <template slot-scope="scope">
          <span>{{ formaterData(stepList, scope.row.step) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="createBy" label="操作人员" />
      <el-table-column prop="createTime" label="操作时间" />
      <el-table-column prop="resultCode" label="结果">
        <template slot-scope="scope">
          <span>{{ scope.row.resultCode===1?'同意':scope.row.resultCode===0?'不同意':scope.row.resultCode===-1?'提交':scope.row.resultCode }}</span>
        </template>
      </el-table-column>
      <el-table-column show-overflow-tooltip prop="remarks" label="意见备注" />
    </el-table>
  </div>
</template>
<script>
import { queryNodeList } from '@/api/marketService/dailyPatrol'
import { getDictByPatchType } from '@/api/dataDict'
import { formaterData } from '@/utils'
export default {
  name: 'NodeList',
  data() {
    return {
      stepList: [],
      formaterData,
      tableData: [],
      patrolId: ''
    }
  },
  async created() {
    const { id, patrolId } = this.$route.query
    this.patrolId = id || patrolId

    this.handleQueryNodeList()
    await getDictByPatchType(['DAILY_STATUS']).then(res => {
      this.stepList = res.DAILY_STATUS
    })
  },
  methods: {
    handleQueryNodeList() {
      if (!this.patrolId) return
      queryNodeList(this.patrolId).then(res => {
        if (res.success) {
          this.tableData = res.data.records
        }
      })
    }
  }
}
</script>
